a = {
	@(x)	(0 <= x & x <= 0.9833) .* (0.834377*x.^1 + 0.0479444*x.^3) + ...
(0.9833 <= x & x <= 2.12439) .* (0.32004 - 0.142048*x.^1 + 0.993008*x.^2 - 0.28868*x.^3) + ...
(2.12439 <= x & x <= 3.2979) .* ( - 4.76718 + 7.04198*x.^1 - 2.38869*x.^2 + 0.241935*x.^3) + ...
(3.2979 <= x & x <= 4.02248) .* (2.61474 + 0.326873*x.^1 - 0.35251*x.^2 + 0.0361298*x.^3) + ...
(4.02248 <= x & x <= 4.83563) .* (7.19366 - 3.08812*x.^1 + 0.496466*x.^2 - 0.0342228*x.^3) + ...
(4.83563 <= x & x <= 5.64877) .* (7.19366 - 3.08812*x.^1 + 0.496466*x.^2 - 0.0342228*x.^3) + ...
(5.64877 <= x & x <= 6.37335) .* ( - 5.48697 + 3.64643*x.^1 - 0.69575*x.^2 + 0.0361298*x.^3) + ...
(6.37335 <= x & x <= 7.54686) .* ( - 58.7665 + 28.7256*x.^1 - 4.63076*x.^2 + 0.241935*x.^3) + ...
(7.54686 <= x & x <= 8.68795) .* (169.309 - 61.9382*x.^1 + 7.38268*x.^2 - 0.28868*x.^3) + ...
(8.68795 <= x & x <= 9.67125) .* ( - 51.4392 + 14.2876*x.^1 - 1.39105*x.^2 + 0.0479444*x.^3)
};
b = {
	@(x)	(0 <= x & x <= 0.9833) .* (1.1547 + 0.730953*x.^1 - 0.266157*x.^3) + ...
(0.9833 <= x & x <= 2.12439) .* (0.692956 + 2.13971*x.^1 - 1.43269*x.^2 + 0.219516*x.^3) + ...
(2.12439 <= x & x <= 3.2979) .* (1.79282 + 0.586517*x.^1 - 0.701559*x.^2 + 0.104796*x.^3) + ...
(3.2979 <= x & x <= 4.02248) .* (20.9699 - 16.8583*x.^1 + 4.58811*x.^2 - 0.429854*x.^3) + ...
(4.02248 <= x & x <= 4.83563) .* ( - 65.643 + 47.7382*x.^1 - 11.4708*x.^2 + 0.900905*x.^3) + ...
(4.83563 <= x & x <= 5.64877) .* (138.093 + 14.6679*x.^2 - 78.6584*x.^1 - 0.900905*x.^3) + ...
(5.64877 <= x & x <= 6.37335) .* ( - 101.769 + 48.7294*x.^1 - 7.88356*x.^2 + 0.429854*x.^3) + ...
(6.37335 <= x & x <= 7.54686) .* (36.6431 - 16.4224*x.^1 + 2.33898*x.^2 - 0.104796*x.^3) + ...
(7.54686 <= x & x <= 8.68795) .* (85.9534 - 36.024*x.^1 + 4.9363*x.^2 - 0.219516*x.^3) + ...
(8.68795 <= x & x <= 9.67125) .* ( - 232.537 + 73.9524*x.^1 - 7.72221*x.^2 + 0.266157*x.^3)
};
syms x y;
equation = x^2 + (3/2*y - sqrt(abs(x)) )^2 - 3;
x_values = linspace(0, 9.67125, 10000); 
a_values = cellfun(@(func) func(x_values), a, 'UniformOutput', false);
b_values = cellfun(@(func) func(x_values), b, 'UniformOutput', false);

figure;
hold on;
for i = 1:length(a)
    plot(a_values{i}, b_values{i}, 'DisplayName', ['a_', num2str(i)]);
end

fimplicit(equation, [-3, 3, -3, 3]);
title('Heart Shape Curve');
xlabel('x');
ylabel('y');
legend('show');

grid on;
hold off;